package pl.edu.pw.polygen.modeler.client.toolbox.buttons;

import pl.edu.pw.polygen.modeler.client.toolbox.command.ICommand;
import pl.edu.pw.polygen.modeler.client.toolbox.command.MergeCommand;
import pl.edu.pw.polygen.modeler.client.workspace.IWorkspace;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;

public class MergeButton extends Button {
	private ICommand command;
	
	public MergeButton(IWorkspace workspace) {
		super();
		this.initialize(workspace);
	}
	
	private void initialize(IWorkspace workspace){
		this.setText("Merge");
		this.setHeight("40px");
		this.setWidth("66px");
		command = new MergeCommand(workspace);  
		this.addClickAction();
	}
	
	private void addClickAction(){
		this.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				command.execute();
			}
		});
	}
}
